debian nginx php mysql |
您所在的位置:网站首页 › debian nginx php › debian nginx php mysql |
顺序是先安装nginx,然后安装mariadb,最后安装PHP。系统用的是debian7安装nginxsudo apt-get install nginx 我这里用的是稳定的源,没用测试的源,所以我这里nginx的版本是1.2.1。配置后续弄。ifconfig获取服务器的ip然后在浏览器里面进行输入,查看是否能正常访问安装mariadbsudo service nginx start 使用下面的命令知道自己的IP为多少:ifconfig eth0 | grep inet | awk '{ print $2 }' 打开默认虚拟主机配置使用下面的命令:sudo nano /etc/nginx/sites-available/default 找到相应的内容进行更改和替换。[...] server { listen 80; root /usr/share/nginx/www; index index.php index.html index.htm; server_name example.com; location / { try_files $uri $uri/ /index.html; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/www; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } [...] 安装mariadb我是用的电子科技大学的源使用下面几条语句就能安装。sudo apt-get install python-software-properties sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db sudo add-apt-repository 'deb http://mirrors.scie.in/mariadb/repo/10.0/debian wheezy main' sudo apt-get update sudo apt-get install mariadb-server PS:参考Mariadb官网mariadb官网链接安装PHPapt-get install php5-fpm php5-memcache php5-mysql 进行PHP的配置修改 使用下面的命令进行打开:sudo nano /etc/php5/fpm/php.ini 找到cgi.fix_pathinfo=1并将1改为0cgi.fix_pathinfo=0 创建一个显示php的测试页 在目录下创建一个测试页。sudo nano /usr/share/nginx/www/info.php 在下面新添加一行: PS:可参考官网的PHP扩展列表 网站配置后续跟上 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |